import time
import turtle as t

#定义显示间隔的函数
def drawGrap():
    t.penup()
    t.fd(7)

#定义画线的函数
def drawLine(draw):
    drawGrap()
    t.pendown() if draw else t.penup()
    t.fd(40)
    drawGrap()
    t.right(90)

#定义实际操作的函数
def drawDight(dight):
    drawLine(True) if dight in[2,3,4,5,6,8,9] else drawLine(False)
    drawLine(True) if dight in [0 , 1, 3, 4, 5, 6, 7, 8, 9] else drawLine(False)
    drawLine(True) if dight in [0, 2, 3, 5, 6, 8, 9] else drawLine(False)
    drawLine(True) if dight in [0, 2, 6, 8] else drawLine(False)
    t.left(90)#使朝向朝上
    drawLine(True) if dight in [0, 4, 5, 6, 8, 9] else drawLine(False)
    drawLine(True) if dight in [2, 3, 0, 5, 7, 8, 9] else drawLine(False)
    drawLine(True) if dight in [0, 1, 2, 3, 4, 7, 8, 9] else drawLine(False)
    t.left(180)
    t.pu()#为绘制后续数字确定位置
    t.fd(20)


def drawdate(date):#获取日期
    t.pencolor("green")
    for i in date:
        if i == '年':
            t.write('年',font = ("Arial",30,"normal"))
            t.pencolor("blue")
            t.fd(50)
        elif i == "月":
            t.write('月',font = ("Arial",30,"normal"))
            t.pencolor("yellow")
            t.fd(50)
        elif i == "日":
            t.write('日',font = ("Arial",30,"normal"))
            t.pencolor("red")
            t.fd(50)
        elif i == "时":
            t.write('时',font=("Arial",30,"normal"))
            t.pencolor("black")
            t.fd(50)
        elif i == "分":
            t.write('分', font=("Arial", 30, "normal"))
            t.pencolor("red")
            t.fd(50)
        elif i == "秒":
            t.write('秒', font=("Arial", 30, "normal"))
            t.pencolor("red")
            t.fd(50)
        else:
            drawDight(eval(i))#通过eval()将数字变成整数
def main():
    t.setup(1500,650,20,20)
    t.pu()
    t.fd(-600)
    t.pensize(5)
    drawdate(time.strftime("%Y年%m月%d日%H时%M分%S秒",time.gmtime()))
    t.hideturtle()
    t.done()
# main(input("请输入一个年月时分，例：2019年01月22日，（默认使用系统时间）:\n"))
main()